package com.tbvtc.agriculturalcreditchainserver2025.vo.ConsumerVo;

import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

@Data
public class AllReportSummaryVo {
    @Schema(description = "报告个数")
    private BigInteger  reportCount;
    @Schema(description = "报告名称")
    private List<String> reportName;
    @Schema(description = "报告时间")
    private List<String> reportTime;
    @Schema(description = "报告类型")
    private List<String> reportType;


        @JsonCreator
        public AllReportSummaryVo(List<Object> array) {
            this.reportCount = (BigInteger) array.get(0);
            this.reportName= (List<String>) array.get(1);
            this.reportTime= getData((List<BigInteger>) array.get(2));
            this.reportType= (List<String>) array.get(3);
        }
    public List<String>  getData(List<BigInteger> reportTime){
//        String result2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(data);
//        return result2;
        List<String> data = new ArrayList<>();
        reportTime.forEach(s->{
            String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(s);
            data.add(format);
        });
        return data;
    }

}
